package org.eclipse.football;

import static org.junit.Assert.*;

import org.junit.Test;

public class BlankPlayerName {

	@Test
	public void test() {
		// Instantiate a team
		Team team = new Team("test","user");
		
		// Instantiate an OffPlayer with a blank name
		OffPlayer off_player = new OffPlayer("", "");
		
		// Get old number of offensive players on team
		int old_num_players = team.getOff_players().size();
		
		// Try to add off_player to team
		team.addOffPlayer(off_player);
		
		// Make sure number of offensive players on team has not changed
		if(team.getOff_players().size() != old_num_players){
			// If not then fail
			fail("Team allowed addition of offensive player with empty name\n");
		}
		
		// Instantiate a DefPlayer with a blank name
		DefPlayer def_player = new DefPlayer("", "");
		
		// Get old number of defensive players on team
		old_num_players = team.getDef_players().size();
		
		// Try to add def_player to team
		team.addDefPlayer(def_player);
		
		// Make sure number of defensive players on team has not changed
		if(team.getDef_players().size() != old_num_players){
			// If not then fail
			fail("Team allowed addition of defensive player with empty name\n");
		}
		
		// Instantiate a kicker with a blank name
		Kicker kicker = new Kicker("", "");
		
		// Get old number of kickers on team
		old_num_players = team.getKickers().size();
		
		// Try to add kicker to team
		team.addKicker(kicker);
		
		// Make sure number of kickers on team has not changed
		if(team.getKickers().size() != old_num_players){
			// If not then fail
			fail("Team allowed addition of kicker with empty name\n");
		}
	}

}
